# -*- coding: UTF-8 -*-
"""
@author: tgy
@file: 1.20 合并多个字典或映射.py
@time: 2021/01/19

ChainMap:与字典类似，添加一直在第一个字典中添加
ditct.update
"""
from collections import ChainMap

def test01():
    ...
    per = {'name':'21','age':21}
    dog = {'run':'run'}
    chain_map = ChainMap(per, dog)
    print(chain_map['run'])
    chain_map['run'] = 'r78'
    # print(dog['run'])
    print(per)

def test02():
    d1 = {'x': 21, 'y':'111'}
    d2 = {'z':22}
    d2.update(d1)
    print(d2)



if __name__ == '__main__':
    pass
    test02()
    help(list)